/*
 * Supplier.cpp
 *
 *  Created on: 29.10.2013
 *      Author: ulgish
 */

#include <lab2/Supplier.h>
#include <unistd.h>
namespace DT {



    Supplier::Supplier(int count)
    {
    	this->count = count;
    }

    void* Supplier::Supplier::run(void *arg)
    {
    	Store& st = (*( (Store*) arg) );
    	DT::writer << "Supplier started\n";
    	int i = 0;
    	while (i < count){
    		if (st++){
    			i++;
    		}else{
    			DT::writer << "Supplier go sleep (1 second)\n";
    			sleep(1);
    			DT::writer << "Supplier go work\n";
    		}
    	}
    	DT::writer << "Supplier go exit\n";
    	return NULL;
    }

Supplier::~Supplier() {
	// TODO Auto-generated destructor stub
}

}
